package ru.dimka3210.java.reminder.threads.daemons;

/**
 * User: dimka3210
 * Date: 16.05.13
 * Time: 20:14
 */
public class Daemon extends Thread implements Runnable {
    public Daemon() {
        setDaemon(true);
    }

    @Override
    public void run() {
        System.out.println("I'm running. (c) Daemon :)");
        while (true) {
            try {
                Thread.sleep(500);
            } catch (Exception e) {
                System.out.println("Exception file **Daemon.java**: " + e.getMessage());
            }
        }
    }

    @Override
    public void interrupt() {
        System.out.println("I'm stopped. (c) Daemon :)");
        super.interrupt();
    }
}
